#include "datedialog.h"
#include "ui_datedialog.h"
#include <QtGui/QDesktopWidget>

DateDialog::DateDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DateDialog)
{
    ui->setupUi(this);

#ifdef Q_OS_ANDROID
    setWindowFlags(Qt::ToolTip);
    if(parent) {
        QRect rect = parent->geometry();
        rect.setHeight(160);
        setGeometry(rect);
    } else {
        QRect rect = QApplication::desktop()->screenGeometry();
        rect.setHeight(160);
        setGeometry(rect);
    }
    setStyleSheet("QDialog{ background-color: rgb(235, 242, 255);border: 1px solid black; border-style: solid; border-radius: 4px; }");
#endif
}

DateDialog::~DateDialog()
{
    delete ui;
}

QVariant DateDialog::getDate()
{
    if( exec() == QDialog::Accepted ) {
        QDate date = ui->calendarWidget->selectedDate();
        return QVariant(date);
    }
    return QVariant();
}
